<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            overflow: hidden;
            padding: 0;
            margin: 0;
        }

        .tab ul li {
            box-sizing: border-box;
            padding: 0;
            float: left;
            width: 100px;
            height: 45px;
            line-height: 45px;
            list-style: none;
            text-align: center;
            border-top: 1px solid #ccc;
            border-right: 1px solid #ccc;
            cursor: pointer;
        }

        .tab ul li.active {
            background-color: orange;
        }

        .tab ul li:first-child {
            border-left: 1px solid blue;
        }

        .tab div {
            width: 500px;
            height: 300px;
            display: none;
            text-align: center;
            font-size: 30px;
            line-height: 300px;
            border: 1px solid blue;
            border-top: 0px;
        }

        .tab div.current {
            display: block;
        }

    </style>
</head>

        <!--点击不同的列表按钮，显示不同的照片：20210340908付飞飞-->

<body>
 
    <div id="app">
        <div class="tab">
            <ul>
                <li :class="currentIndex==index?'active':''" :key="item.id" v-for="(item,index) in list"  v-on:click="handlc">{{item.title}}
                </li>
            </ul>
            <div :class="currentIndex==index?'current':''" :key="item.id" v-for="(item,index) in list">
                <img :src="item.path">
            </div>
        </div>

    </div>


    <script type="text/javascript" src="vue.js"></script>
    <script type="text/javascript">
        /*  */
        var vm = new Vue({
            el: '#app',
            data: {
                currentIndex: 0,
                list: [{
                    id: 1,
                    title: 'apple',
                    path: 'images/image01.jpg'
                }, {
                    id: 2,
                    title: 'orange',
                    path: 'images/image02.jpg'
                }, {
                    id: 3,
                    title: 'lemon',
                    path: 'images/image03.jpg'
                }]
            },
            methods: {
                handlc: function () {
                    this.currentIndex = this.currentIndex + 1
                    if (this.currentIndex > 2) {
                        this.currentIndex = 0
                    }

                },

            }
        })
    </script>


</body>
</html>